package com.example.testapplication.ui.home.home_list_fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.lifecycle.Observer;

import com.example.testapplication.R;
import com.example.testapplication.databinding.FragHomeListBinding;

import me.goldze.mvvmhabit.base.BaseFragment;

import me.tatarka.bindingcollectionadapter2.BR;

public class HomeListFragment extends BaseFragment<FragHomeListBinding, HomeListFragViewModel> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.frag_home_list;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initViewObservable() {
        viewModel.uc.finishRefreshing.observe(this, new Observer() {
            @Override
            public void onChanged(Object o) {
                binding.homeRefresh.finishRefresh(1000);
            }
        });

        viewModel.uc.finishLoadmore.observe(this, new Observer() {
            @Override
            public void onChanged(Object o) {
                binding.homeRefresh.finishLoadMore(1000);
            }
        });
    }
}
